<script setup lang="ts">
import { onMounted, reactive } from 'vue';
import { RouterView } from 'vue-router'
import axios from 'axios';
import UPloader from '@/components/UPloader.vue'
const open = ()=>{
  window.open('http://localhost:7006/auth/passport/gitee', '_blank','height=500,width=500,top=0,left=0')
}
const state = reactive({
  data: {},
});
let index=0;
onMounted(() => {
  window.addEventListener('message', m=>{
    const {type, token} = m.data
    state.data = m.data
    if (type === 'oauth-token') {
      axios.get('http://localhost:7006/api/users/current', {
        headers:{ Authorization: `Bearer ${token}`}
      }).then((data)=> {
      },)
    }
  })
});
</script>

<template>
  <!-- <button @click="open">使用 Gitee 登录</button>
  {{ state.data }}
  <UPloader action="http://p-test-server.com:7006/project/image/upload" list-type="picture" :show-upload-list="true"
    class="styled-uploader"></UPloader> -->
  <RouterView />
</template>

<style scoped>
</style>
